/*
 *    Thing Game Library
 *   Copyright (C)2005 - 2010 Eduardo Nunes Pereira (eduardonunesp at gmail dot com)
 *
 *   This program/library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 *   This program/library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 *    You should have received a copy of the GNU Lesser General Public
 * License along with this program/library ; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef __VIDEOMANAGER_HPP__
#define __VIDEOMANAGER_HPP__

#include <SDL/SDL.h>
#include "NonCopyable.hpp"
#include "Exception.hpp"

namespace Thing
{
    namespace Video
    {
        class VideoException : public Utils::Exception
        {
        public:
            typedef enum
            {
                VIDEO_MODES_UNAVAIBLE,
                UNINITIALIZED_VIDEO,
                NULL_SCREEN_SURFACE
            } FailType;

            VideoException(FailType fail, const std::string& what) : 
                Utils::Exception(what), fail_type(fail)  {}
            FailType fail_type;
        };

        class Surface;
        class VideoMode
        {
        public:
            VideoMode(unsigned int w, unsigned int h, unsigned int r, unsigned int f) :
                width(w), height(h), res(r), flags(f) {}

            unsigned int width;
            unsigned int height;
            unsigned int res;
            unsigned int flags;
        };

        class VideoManager : public Utils::NonCopyable
        {
        public:

            struct Flag
            {
                enum 
                {
                    SOFT_RENDER = SDL_HWSURFACE,
                    HARD_RENDER = SDL_SWSURFACE,
                    FULL_SCREEN = SDL_FULLSCREEN
                } flags;
            };

            VideoManager();
            ~VideoManager();

            void initialize(const VideoMode& vmode);
            void update();

        private:
            Surface *_screen;
        };
    }
}

#endif /* __VIDEOMANAGER_HPP__ */
